<template>
	<view>
		<view class="boxes uniFlex">
			<view class="title">订单支付：</view>
			<view>{{msg.number}}</view>
		</view>
		<view class="boxes uniFlex">
			<view class="title">订单标题：</view>
			<view>{{msg.title}}</view>
		</view>
		<view class="boxes uniFlex">
			<view class="title">订单类型：</view>
			<view v-if="msg.type == 0">国家电网</view>
			<view v-else>南方电网</view>
		</view>
		<view class="boxes uniFlex">
			<view class="title">支付类型：</view>
			<view v-if="msg.pay_type == 0">余额支付</view>
			<view v-else-if="msg.pay_type == 1">微信支付</view>
			<view v-else-if="msg.pay_type == 2">支付宝支付</view>
		</view>
		<view class="boxes uniFlex">
			<view class="title">户号：</view>
			<view>{{msg.huhao}}</view>
		</view>
		<view class="boxes uniFlex">
			<view class="title">充值金额：</view>
			<view>{{msg.price}}</view>
		</view>
		<view class="boxes uniFlex">
			<view class="title">支付金额：</view>
			<view>{{msg.money2}}</view>
		</view>
		<view class="boxes uniFlex">
			<view class="title">实际金额：</view>
			<view>{{msg.money}}</view>
		</view>
		<view class="boxes uniFlex">
			<view class="title">优惠金额：</view>
			<view>{{msg.youhui}}</view>
		</view>
		<view class="boxes uniFlex">
			<view class="title">支付状态：</view>
			<view v-if="msg.status == 0">待支付</view>
			<view v-else-if="msg.status == 1">已支付</view>
			<view v-else-if="msg.status == 3">已退款</view>
		</view>
		<view class="boxes uniFlex" v-if="msg.time">
			<view class="title">下单时间：</view>
			<view>{{msg.time}}</view>
		</view>
		<view class="boxes uniFlex" v-if="msg.pay_time">
			<view class="title">支付时间：</view>
			<view>{{msg.pay_time}}</view>
		</view>
		<view class="boxes uniFlex">
			<view class="title">充值状态：</view>
			<view v-if="msg.c_status == 0">待充值</view>
			<view v-else-if="msg.c_status == 1">已充值</view>
			<view v-else-if="msg.c_status == 2">充值失败</view>
		</view>
		<view class="boxes uniFlex" v-if="msg.c_time">
			<view class="title">充值时间：</view>
			<view>{{msg.c_time}}</view>
		</view>
		
		<view class="msg">如有疑问请在首页联系客服支付成功后大部分将在3小时内充值成功，请耐心等待~</view>
		<view class="btn" @click="refresh">点击刷新订单状态</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id:'',
				msg:{}
			}
		},
		onLoad(option) {
			this.id = option.id;
			this.getDetail();
		},
		methods: {
			async getDetail(num) {
				let res = await this.$api.orderdetail({
					id:this.id
				});
				if (res.code == 200) {
					this.msg = res.data;
					if(num==1){
						uni.showToast({
							title:'已刷新'
						})
					}
				}
			},
			refresh(){
				this.getDetail(1)
			}
		}
	}
</script>

<style scoped lang="scss">
page{
	background: #fff;
}
.boxes{
	margin: 30upx;
	padding-bottom: 20upx;
	border-bottom: 1px solid #eee;
	
	.title{
		width: 160upx;
	}
}
.msg{
	margin: 30upx;
	color: #D1C1C1;
}
.btn{
	padding:30upx;
	color: #5FABFF;
}
</style>
